﻿namespace Anurgath.Shoutbox.Models
{
    #region Usings
    using Orchard.ContentManagement;
    using Orchard.Core.Common.Utilities;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Web;
    #endregion

    public class ShoutboxPart : ContentPart<ShoutboxPartRecord>
    {
        #region Properties
        [Required, Range(1, 100)]
        public int HowManyPostsToShow
        {
            get
            {
                return Record.HowManyPostsToShow;
            }
            set
            {
                Record.HowManyPostsToShow = value;
            }
        }

        internal LazyField<IEnumerable<PostPart>> PostsField = new LazyField<IEnumerable<PostPart>>();

        public IEnumerable<PostPart> Posts
        {
            get
            {
                return PostsField.Value;
            }
            set
            {
                PostsField.Value = value;
            }
        }
        #endregion
    }
}